package com.atomos.system
{
	import com.atomos.particle.Particle;
	import com.atomos.strategy.action.ActionStrategy;
	import com.atomos.strategy.action.NullAction;
	import com.atomos.strategy.initialize.InitializeStrategy;
	import com.atomos.strategy.initialize.NullInitializer;	

	public class SimpleParticleSystem extends AbstractParticleSystem
	{
		protected var _oAction : ActionStrategy;
		protected var _oInitializer : InitializeStrategy;
		
		/*-----------------------------------------------------------------
				PUBLIC METHODS
		------------------------------------------------------------------*/

		public function SimpleParticleSystem( initializer : InitializeStrategy = null, action : ActionStrategy = null )
		{
			super();
			setInitializer( initializer );
			setAction( action );
		}
		
		public function setAction ( action : ActionStrategy = null ) : void
		{
			_oAction = action ? action : new NullAction();
		}
		
		public function getAction () : ActionStrategy
		{
			return _oAction;
		}
		
		public function setInitializer( initializer : InitializeStrategy = null ) : void
		{
			_oInitializer = initializer ? initializer : new NullInitializer();
		}
		
		public function getInitializer () : InitializeStrategy
		{
			return _oInitializer;
		}
		
		/*-----------------------------------------------------------------
				PROTECTED METHODS
		------------------------------------------------------------------*/
		
		protected override function _initializeParticle( particle : Particle, time : Number) : void
		{
			_oInitializer.initialize( particle );
			_oAction.prepareAction( time );
			_oAction.process( particle );
		}
		
		protected override function _prepareAction( time : Number ) : void
		{
			_oAction.prepareAction( time );
		}
		
		protected override function _processParticle( particle : Particle ) : void
		{
			_oAction.process( particle );
		}
	}
}